<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ include file="/taglibs.jsp"%>
<s:url value="/images" var="imgPath"/>
<!-- 月历 -->
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick.js"></script>
<script type="text/javascript" charset="UTF-8" src="/js/jquery.datepick-zh-CN.js"></script>
<link rel="stylesheet" type="text/css" href="/css/smoothness.datepick.css" />
<script language="javascript">
	$().ready( function() {
		$('#paramStartDate').datepick({minDate: null, showOn: 'both', 
	    	buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',numberOfMonths:2,dateFormat:"yy-mm-dd",yearRange: '-50:+50'});
		$('#paramEndDate').datepick({minDate: new Date(), showOn: 'both', 
		   	  buttonImageOnly: true, buttonImage: '${imgPath}/calendar.gif',numberOfMonths:2,beforeShow:customRange,dateFormat:"yy-mm-dd",yearRange: '-50:+50'});
		function customRange (){
			var startDt = $('#paramStartDate').val(); //起始日
			var endDt = new Date(parseInt(startDt.substring(0,4),10),parseInt(startDt.substring(5,7),10)-1,parseInt(startDt.substring(8,10),10)); //結束日
			return {minDate:endDt}; 
		}
	});	

</script>
<s:actionerror />
<s:actionmessage />
<s:fielderror />
<s:form action="search.do" method="post" id="formObj">
	<s:hidden name="currentPage" />
	<h1>积分发送管理</h1>
	<div class="f-link">
		<a href="edit.do">新增</a>
		<a href="#" onclick="document.formObj.submit();">搜寻</a>
	</div>
	<div class="data-form">
	<b>名称：</b> <s:textfield name="paramName" /> <br/>
	<b>期间：</b> 
	<input name="paramStartDate" id="paramStartDate" size="10" value="${paramStartDate}" >
	<input name="paramEndDate" id="paramEndDate" size="10" value="${paramEndDate}"><br/>
	<b>预算归属：</b> <label><input name="paramBudget" type="radio" value="" <s:if test = " paramBudget == '' ">checked="checked"</s:if>/>不限</label> <s:radio name="paramBudget" list="menuBudget.options" listKey="key" listValue="value.name" /><br/>
	</div>
</s:form>
<br />
<br />
<br />
<s:if test="giveBonusList.size > 0">
	<yaodian100:pageutil pagerObj="${pager}" link="search.do?paramName=${paramName}&paramStartDate=${paramStartDate}&paramEndDate=${paramEndDate}&paramBudget=${paramBudget }"/>
	<table width="600">
		<thead class="tb-1" >
			<tr>
				<th>#</th>
				<th>名称</th>
				<th>类别</th>
				<th>期间</th>
				<th>说明</th>
				<th>预算归属</th>
			</tr>
		</thead>
		<tbody class="tb-1" >
			<c:forEach items="${giveBonusList}" var="giveBonus" varStatus="rows_index">
				<tr class="${rows_index.count % 2 == 0 ? 'bg-yl' : ''}">
					<td>${rows_index.count + pager.currentPage*pager.pageRecord}</td>
					<td><a href="view.do?bonusUuid=${giveBonus.uuid}" />${giveBonus.name}</a></td>
					<td>活动赠点</td>
					<td>
						<fmt:formatDate value="${giveBonus.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/> ~ 
						<fmt:formatDate value="${giveBonus.expireDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
					</td>
					<td>${giveBonus.description}</td>
					<td>${menuBudget.options[giveBonus.budget].name}</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<yaodian100:pageutil pagerObj="${pager}" link="search.do?paramName=${paramName}&paramStartDate=${paramStartDate}&paramEndDate=${paramEndDate}&paramBudget=${paramBudget }"/>
</s:if>
